<!DOCTYPE html>
<html>
<head>
  <title>Direct Sockets Open Test</title>
  <script>
    'use strict';

    async function openTcp(options) {
      try {
        let tcpSocket = await navigator.openTCPSocket(options);
        return ('openTcp succeeded: ' +
                '{remoteAddress: "' + tcpSocket.remoteAddress +
                '", remotePort: ' + tcpSocket.remotePort + '}');
      } catch(error) {
        return ('openTcp failed: ' + error);
      }
    }

    async function openUdp(options) {
      try {
        let udpSocket = await navigator.openUDPSocket(options);
        return ('openUdp succeeded: ' +
                '{remoteAddress: "' + udpSocket.remoteAddress +
                '", remotePort: ' + udpSocket.remotePort + '}');
      } catch(error) {
        return ('openUdp failed: ' + error);
      }
    }

  </script>
</head>
<body>
  <h1>Direct Sockets Open Test</h1>
</body>
</html>
